package ClassWork.Work_03.Calculator;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Calculator calculator = new Calculator();
        Scanner sc = new Scanner(System.in);

        System.out.println("请输入第一个数字");
        int num1 = sc.nextInt();
        System.out.println("请输入第二个数字");
        int num2 = sc.nextInt();
        System.out.println("请输入要进行的计算：1.+，2.-，3.*，4./，5.%");
        String s = sc.next();

        switch (s) {
            case "+":
                calculator = new Addition();
                break;
            case "-":
                calculator = new Subtraction();
                break;
            case "*":
                calculator = new Multiplication();
                break;
            case "/":
                calculator = new Division();
                break;
            case "%":
                calculator = new Remainder();
                break;
            default:
                System.out.println("输入错误");
        }

        calculator.setNum1(num1);
        calculator.setNum2(num2);
        int result = calculator.result();
        System.out.println("运算的结果是：" + result);
    }
}
